Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
dyn-template
Advanced tools
Dynamic Template string. It is all the same with Template Literal String in Javascript besides instead of returning a string, it returns a function whose return value is a string.
npm i dyn-template
import { dyn } from 'dyn-template'
let n = 0
const random = dyn`${() => ++n}. ${Math.random}`
while (n < 5) console.log(random())
// Maybe
//
// 1. 0.7632479109972825
// 2. 0.31000327931995975
// 3. 0.014416508824629193
// 4. 0.7325147663760406
// 5. 0.8938454844327381
If the expression in template is a function, the function will be executed every time when the dynamic template is executed. On the other hand, if the expression is not a function, it will be calculated only once when the dynamic template is created.
import { dyn } from 'dyn-template'
const template = dyn`Compiled at ${Date.now()}, Running at ${Date.now}`
for (let n = 0; n < 1000; ++n) console.log(template())
// Maybe
//
// Compiled at 1729781340083, Running at 1729781340083
// ...
// Compiled at 1729781340083, Running at 1729781340084
// ...
// Compiled at 1729781340083, Running at 1729781340085
// ...
FAQs
Dynamic Template string
We found that dyn-template demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.